package fag.core.game.test;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import fag.core.geometry.Circle2D;
import fag.core.geometry.Rectangle2D;
import fag.core.geometry.Vector2D;
import fag.core.model.Animation;
import fag.core.model.Frame;
import fag.core.model.Model;
import fag.core.model.SerializableImage;
import fag.core.model.Sprite;

/**
 * Modèle de balle.
 * @author lumz.
 */
public class BallModel extends Model {

	private static final long serialVersionUID = -7789355655113780309L;

	public BallModel() {
	
		// Création de l'animation idle
		Animation idle = new Animation("idle");	
		
		Frame f1 = new Frame(200);
		BufferedImage bufferedImage = null;
		
		try {
			bufferedImage = ImageIO.read(new File(System.getProperty("user.dir")+"/src/imgs/circle.png"));
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		Sprite s1 = new Sprite(new SerializableImage(bufferedImage),new Vector2D());
		Circle2D hitbox = new Circle2D(16, 16, 16);
		
		f1.setHitbox(hitbox);
		f1.setSprite(s1);
		f1.updateBounds();
		idle.addFrameAtEnd(f1);
		
		// Ajout des animations
		getListAnimation().add(idle);
	}
}